package com.tonysong.oa.yeboa12.config.exception;

import com.tonysong.oa.yeboa12.config.util.R;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice  //AOP
public class GlobaException {

    @ExceptionHandler(UsernameNotFoundException.class)
    public R  usernameNotFoundException(UsernameNotFoundException ex) {
        return new R(400, false, "错误的账号或密码！");
    }
}
